package com.dongchedi.config;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.session.web.http.CookieSerializer;
import org.springframework.session.web.http.DefaultCookieSerializer;

/**
 * @author leibidong
 * @description 解决cookie跨域无法携带
 * @date 2021/7/2
 */
@Configuration
public class TomcatConfig {
        @Bean
        public CookieSerializer httpSessionIdResolver() {
            DefaultCookieSerializer cookieSerializer = new DefaultCookieSerializer();
            cookieSerializer.setCookieName("ticket");
            cookieSerializer.setUseHttpOnlyCookie(false);
            cookieSerializer.setSameSite(null);
            return cookieSerializer;
        }
}
